package com.chenfan.mapper;

import com.chenfan.pojo.Book;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper {
    @Select("select * from book")
    List<Book> list();

    void delete(List<Integer> ids);

    @Insert("insert into book(name,author,press,price,publishDate,create_time,update_time)" +
            "values (#{name},#{author},#{press},#{price},#{publishDate}, #{createTime}, #{updateTime});")
    void add(Book book);

    @Select("select * from book where id=#{id}")
    Book findById(Integer id);

    void update(Book book);
}
